/**
 * 框架相关的js内容
 */

/**
 * menu 菜单 实现
 */
let menus = [
	{
		id:'00',
		name:'百度地图',
		url:'',
		menus:[
			{id:'00_00',name:'电子围栏',url:'/bmap/polygon'},
			{id:'00_01',name:'mybatis plus 测试',url:'data/mybatisplus'}
		]
	},
	
];
// 生成菜单
$.each(menus, function(key, val) {
	let menu  = '<li class="layui-nav-item layui-nav-itemed">';
	menu += '<a class="menu" id = "menu_'+val.id+'" data-id = "' + val.url + '">'+val.name+'</a>';
	menu += '<dl class="layui-nav-child">';
	$.each(val.menus, function(keyx, valx) {
		menu += '<dd><a class="menu" id = "menu_'+valx.id+'" data-id = "' + valx.url + '">'+valx.name+'</a></dd>';
	});
	menu += '</dl></li>';
	console.log(menu);
	$('.menus').append(menu);
});

// 点击了菜单
$('.menu').on('click',function(){
	let id = $(this).data('id');// url 
	console.log(id);
	if($.isEmptyObject(id)){return;}
	$('.iframe').attr('src',id)
})






